import request from "../axios";

/**
 * 获取试卷
 * @param {*} data
 * @returns
 */
export function getTopics(data) {
    return request({
        method: "POST",
        url: '/topic/select',
        data: data
    })
}

/**
 * 查询工种是否存在
 * @param workType
 * @param evaluationLevel
 * @returns {Promise<AxiosResponse<any>>}
 * @constructor
 */
export function isTopic(workType,evaluationLevel) {
    return request({
        method: "GET",
        url: '/topic/isTopic',
        params: {
            workType,evaluationLevel
        }
    })
}

/**
 * 删除题库
 * @returns {Promise<AxiosResponse<any>>}
 */
export function delTopic() {
    return request({
        method: "GET",
        url: '/topic/delTopic',
    })
}

/**
 * 上传题库
 * @param fileName
 * @returns {Promise<AxiosResponse<any>>}
 */
export function setTopic(fileName) {
    return request({
        method: "GET",
        url: '/topic/addTopic',
        params:{
            fileName
        }
    })
}

/**查重
 *
 * @param fileName
 * @returns {Promise<AxiosResponse<any>>}
 */
export function checkTopic(fileName) {
    return request({
        method: "GET",
        url: '/topic/checkTopic',
        params:{
            fileName
        }
    })
}



export function isStart() {
    return request({
        method: "POST",
        url: '/start/isStart'

    })
}


// /**
//  * 获取试卷
//  * @param {*} data
//  * @returns
//  */
// export function getTopics(data) {
//     return request({
//         method: "POST",
//         url: '/topic/select',
//         responseType: 'blob',
//         data: data
//     })
// }

/**
 * 获取选项题目数量
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export function getSelectTopicNum(data) {
    return request({
        method: "POST",
        url: '/topic/selectTopicNum',
        data: data
    })
}


